var last_page;
var videotype = ''
var titlestr = '精彩短片'
console.log("开始")
module.exports = {
    type: 'list',
    title: '红杏->类型选择',
    actions: [
        {
            title: '日本AV',
            onClick: async function () {
                videotype = '8'
                this.refresh()
            }
        },
        {
            title: '国产视频',
            onClick: async function () {
                videotype = '7'
                this.refresh()
            }
        },
        {
            title: '中文字幕',
            onClick: async function () {
                videotype = '10'
                this.refresh()
            }
        },
        {
            title: '韩国剧情',
            onClick: async function () {
                videotype = '9'
                this.refresh()
            }
        },
        {
            title: '台湾SWAG',
            onClick: async function () {
                videotype = '13'
                this.refresh()
            }
        },
        {
            title: '欧美成人',
            onClick: async function () {
                videotype = '32'
                this.refresh()
            }
        },
    ],
    searchRoute: $route('list'),
    async fetch({ args, page }) {
    var resp

    var itmes
    if (page == null) {
      resp = await $http.post('http://v1.91easystudy.com/v1/app/cate/filter', { 
      cate_id: videotype, 
      page: '1',
      page_size:'20'
      })
      //console.log(resp.data)
    } else {
      resp = await $http.post('http://v1.91easystudy.com/v1/app/cate/filter', { 
      cate_id: videotype, 
      page: page || 1,
      page_size:'20'
      })
      //console.log(page)
    }
    itmes = resp.data.data.map(data => ({
      style: 'live',
      title: data.title,
      image: data.thumb,
      route: $route('xj/detail', {
        id: data.id,
        title:data.title,
        type: 'hx',
        detailimage: data.coverpath
      })
    }))
    return {
      nextPage: (page || 1) + 1,
      items: itmes
    }
  }
}